package game;

import game.Utils.DestroyWatchdog;

import java.awt.*;

public abstract class SceneObject {

    public SceneObject() {
        if(Scene.getInstance() == null){
            try {
                throw new Exception("SceneObject cannot be created without a scene.");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        Scene.getInstance().registerSceneObject(this);
    }

    public void destroy(){
        Scene.getInstance().deleteSceneObject(this);
    }

    public void destroy(double time) throws Exception{
        new DestroyWatchdog(this, time);
    }

    public abstract void update(double deltaTime);
    public void lateupdate(double deltaTime){}

}
